home *** CD-ROM | disk | FTP | other *** search
/ Aminet 50 / Aminet 50 (2002)(GTI - Schatztruhe)[!][Aug 2002].iso / Aminet / text / edit / tecoc-146.lha / exelbr.c < prev    next >
C/C++ Source or Header  |  1991-07-05  |  1KB  |  64 lines

  1. /*****************************************************************************
  2.  
  3.     ExeLBr()
  4.  
  5.     This function executes a left-bracket ([) command.
  6.     [q    Q-register push
  7.  
  8. *****************************************************************************/
  9.  
  10. #include "zport.h"        /* define portability identifiers */
  11. #include "tecoc.h"        /* define general identifiers */
  12. #include "defext.h"        /* define external global variables */
  13. #include "deferr.h"        /* define identifiers for error messages */
  14.  
  15. DEFAULT ExeLBr()                /* execute [ command */
  16. {
  17.     QRptr        TmpQRp;
  18.     ptrdiff_t    TmpSiz;
  19.  
  20. #if DEBUGGING
  21.     static char *DbgFNm = "ExeLBr";
  22.     sprintf(DbgSBf, "QStTop = %d", QStTop);
  23.     DbgFEn(1,DbgFNm,DbgSBf);
  24. #endif
  25.     if (IncCBP() == FAILURE) {
  26.         DBGFEX(1,DbgFNm,"IncCBP() FAILURE");
  27.         return FAILURE;
  28.     }
  29.  
  30.     if (FindQR() == FAILURE) {
  31.         DBGFEX(1,DbgFNm,"FindQR() FAILURE");
  32.         return FAILURE;
  33.     }
  34.  
  35.     if (++QStTop >= QRS_SIZE) {
  36.         ErrMsg(ERR_PDO);        /* push-down list overflow */
  37.         DBGFEX(1,DbgFNm,"ERR_PDO FAILURE");
  38.         return FAILURE;
  39.     }
  40.  
  41. /*
  42.  * Copy QR to top of QStack
  43.  */
  44.     TmpQRp = QR;
  45.     QR = &QStack[QStTop];
  46.     TmpSiz = TmpQRp->End_P1 - TmpQRp->Start;
  47.     if (TmpSiz > 0) {
  48.         if (MakRom((SIZE_T)TmpSiz) == FAILURE) {
  49.             QR = TmpQRp;
  50.             --QStTop;
  51.  
  52.             DBGFEX(1,DbgFNm,"MakRom() FAILURE");
  53.             return FAILURE;
  54.         }
  55.         MEMMOVE(QR->Start, TmpQRp->Start, (SIZE_T) TmpSiz);
  56.         QR->End_P1 = QR->Start + TmpSiz;
  57.     }
  58.     QR->Number = TmpQRp->Number;
  59.     QR = TmpQRp;
  60.  
  61.     DBGFEX(1,DbgFNm,"SUCCESS");
  62.     return SUCCESS;
  63. }
  64.